package io.hxci.modules.stu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.hxci.common.utils.PageUtils;
import io.hxci.common.utils.Query;
import io.hxci.modules.edu.dao.EduStudentMapper;
import io.hxci.modules.edu.domain.EduClass;
import io.hxci.modules.edu.domain.EduSign;
import io.hxci.modules.edu.domain.EduStudent;
import io.hxci.modules.stu.domain.EvalType;
import io.hxci.modules.stu.service.EvalTypeService;
import io.hxci.modules.sys.entity.SysUserEntity;
import io.hxci.modules.sys.service.SysUserService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.hxci.modules.stu.dao.EvalApplyMapper;
import io.hxci.modules.stu.domain.EvalApply;
import io.hxci.modules.stu.service.EvalApplyService;
@Service
public class EvalApplyServiceImpl extends ServiceImpl<EvalApplyMapper, EvalApply> implements EvalApplyService{
    @Autowired
    EvalApplyMapper applyMapper;

    @Autowired
    EduStudentMapper studentMapper;

    @Override
    public PageUtils queryPage(Long sid,Map<String, Object> params) {
        IPage<EvalApply> page = new Query<EvalApply>().getPage(params);
        String status = (String)params.get("status");
        if(status == null)status ="0";
        List<EvalApply> list =this.baseMapper.applay(sid,status);
        page.setRecords(list);
        return new PageUtils(page);
    }

    @Override
    public EvalApply applayOne(Integer id) {
        return applyMapper.applayOne(id);
    }

    @Override
    public PageUtils clazzQuery(Long sid, Map<String, Object> params) {
        IPage<EduClass> page = new Query<EduClass>().getPage(params);


        List<EduClass> list =this.baseMapper.clazzQuery(sid);
        page.setRecords(list);
        return new PageUtils(page);
    }

    @Override
    public PageUtils stuQuery(String cid, Map<String, Object> params) {
        IPage<EduStudent> page = new Query<EduStudent>().getPage(params);


        List<EduStudent> list =studentMapper.selectList(new QueryWrapper<EduStudent>().eq(StringUtils.isNotBlank(cid),"oldbj",cid));
        page.setRecords(list);
        return new PageUtils(page);
    }

    @Override
    public PageUtils stuQueryByGuid(Long sid, Map<String, Object> params) {
        IPage<EduStudent> page = new Query<EduStudent>().getPage(params);


        List<EduStudent> list =this.baseMapper.stuQueryByGuid(sid);
        page.setRecords(list);
        return new PageUtils(page);
    }
}
